import React from 'react'
import Divbut from './component/Divbut'
import axios from 'axios'
import './App.css'
import { useState, useEffect } from 'react'
export default function App() {
  const [list, setlist] = useState([])
  const [arr, setarr] = useState([])
  useEffect(() => {
    axios.get('http://localhost:3000/comments').then((res) => {
      setlist(res.data)
    })
    axios.get('http://localhost:3000/xuan').then((res) => {
      setarr(res.data)
    })
  }, [])
  return (
    <div className='apps'>
      <div className='tops'>
        <h1>五常米乳</h1>
      </div>
      <div className='sketch'>
        {
          list.map((item) => {
            return (
              <div key={item.id}>
                <h3>{item.name}</h3>
                <p>{item.jieshao}</p>
              </div>
            )
          })
        }
      </div>
      <Divbut arr={arr}></Divbut>
    </div>
  )
}
